<?php
if (isset($_POST['logout_submit'])) {
	unset($_SESSION['instructor']);
	session_unset();
	session_destroy();
	setcookie('etat_login','',0);
	redirect('index.php?m=1');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-type">
<title><?php print $page_title; ?></title>
<meta content="electronic teamwork assessment tool" name="description">
<meta content="electronic, teamwork, assessment, teamwork assessment, participation metrics" name="keywords">
<link type="image/png" href="<?php print BRANCH; ?>favicon.png" rel="icon"><?php
foreach($style_sheet as $css) {
	if(file_exists(ROOT . BRANCH . "includes/$css.css"))
	print "<link href='" . HOST . "/includes/$css.css' rel='stylesheet' type='text/css'>";
}
foreach($java_script as $js) {
	if(file_exists(ROOT . BRANCH . "/includes/$js.js"))
	print "<script language='JavaScript' type='text/javascript' src='" . HOST . "/includes/$js.js'></script>";
}
?>
</head>
<body>
<div id="fade" class='invisible' onclick='closePopup();'></div>
<div id='header'>
<p id='host-name' class='none'><?php print HOST; ?></p>
<div id='header-wrap'>
<?php if(isLoggedIn()) { ?>
	<div id='logo'><img id='logo-logged-in' onclick="redirect('');" src='<?php print HOST; ?>/includes/images/btn/logo.png'></img></div>
	<?php
	$form = new Form('logout_form','post',true,array('class'=>'right'));
	$form->text("Welcome, <b>".$instructor->full_name.'.</b> ');
	$form->text("<div class='clear'></div>");
	$form->button('logout_submit','Logout',array('class'=>'right'),false);
	$form->button('profile','Profile',array('type'=>'button','onclick'=>'redirect("profile.php")','class'=>'right'),false);
	print $form->build();
} else {
	?>
	<div id='logo'>
		<img onclick="redirect('');" src='<?php print HOST; ?>/includes/images/btn/logo.png'></img>
		<span onclick="redirect('');">Electronic Teamwork Assessment Tool</span>
	</div>
	<div id='header-options'>
	<?php
	print button('login','Login',array('type'=>'button','onclick'=>'redirect("login.php");'),false);
	print button('admin','Admin',array('type'=>'button','onclick'=>'redirect("admin.php");'),false);
}
?>
	</div>
<div class='clear'></div>
</div>
</div>
<div id='<?php print URLNAME?>' class='content'>